<template>
	<view class="h-100">
		<view class="row j-sb px-2">
			<view class=" w-49 mb-2" v-for="(item,index) in list" :key="index" @tap="toGoodDetail">
				<image class="w-100" :src="item.imgUrl" mode="widthFix"></image>
				<view class="">
					<view class="font-25 clamp-2 lh-1 px-1 fcolor-1">
						{{item.goodName}}
					</view>
					<view class="font-40 fcolor-2 px-1">
						￥{{item.goodPrice}} <text class="text-through fcolor-1 font-30 ml-1">￥198.0</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				googObj: {
					imgUrl: 'https://img.alicdn.com/imgextra/i4/14219353/O1CN01gQNyZB2Ixj6hx5gmM_!!0-saturn_solar.jpg_468x468q75.jpg_.webp',
					goodName: '秋冬新款姜黄色丝绒西装收腰显瘦厚金丝绒西服长裤两件套OL套装女',
					goodPrice: '100'
				}
			}
		},
		onLoad() {
			this.addGoods()
		},
		methods: {
			toGoodDetail() {
				uni.navigateTo({
					url: '/pages/goodDetails/goodDetails'
				})
			},
			addGoods() {
				let arr = []
				for (let i = 0; i < 5; i++) {
					arr.push(this.googObj)
				}
				this.list = [...this.list, ...arr]
			}
		},
		onReachBottom() {
			 uni.showToast({
				title: '加载中',
				icon: 'loading',
			})
			setTimeout(this.addGoods,2000)
		},
		onPullDownRefresh() {
			console.log("下拉刷新");
			this.list=[]
			this.addGoods()
			uni.stopPullDownRefresh()
		}
	}
</script>

<style>

</style>
